package com.ziyun.pop.rest.module.customer;

import com.ziyun.pop.common.utils.UserUtils;
import com.ziyun.pop.modules.storeMember.service.StoreMemberService;
import io.renren.common.utils.R;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author jiangli
 * @date 2019-01-05 9:55
 * 客户信息
 */
@Api(value = "CustomerRestApi", tags = "客户信息")
@RestController
@RequestMapping("popApi/customer")
public class CustomerRestApi {

    @Autowired
    private StoreMemberService storeMemberService;

    @ApiOperation(value = "客户列表")
    @ApiResponses(value = @ApiResponse(code = 200, message = "获取成功"))
    @ApiImplicitParam(name = "params", value = "查询客户列表参数", required = true, paramType = "body")
    @PostMapping("customers")
    public R customer(@RequestBody Map<String,Object> params) {
       params.put("sellerId",UserUtils.getCurentUser().getSellerId());
        return storeMemberService.customer(params);
    }

    @ApiOperation(value = "客户管理")
    @ApiResponses(value = @ApiResponse(code = 200, message = "获取成功"))
    @GetMapping("customerManager")
    public R customerManager() {
        Integer sellerId=UserUtils.getCurentUser().getSellerId().intValue();
        return storeMemberService.customerManager(sellerId);
    }



}
